Repository navigation
feat(carve): carve bridge — patch the surviving Terraform (#197) - #996
Merged
Merged
Conversation
The boundary-bridging centerpiece. `chant carve bridge --from <tf-dir> --select <address>` generates the edits to the Terraform you leave behind so its plan stays valid once the resource is chant-owned: - inbound edges → a `data` source for the carved resource + rewired `type.name.attr` references (survivor keeps reading it, now via data). - outbound edges → recorded as deferred deploy-time inputs (wired at apply). - a reversible, observe-first handoff runbook (state rm, patch, import-back). Safe by default: writes proposals to an output dir for review. --apply-rewrites edits the survivor .tf in place (opt-in). The rewrite is idempotent, never double-prefixes a data ref, and leaves the carved resource's own declaration (quoted labels) untouched. Pure text transform, fully unit-tested. PR B of 3 (#197). Next: apply graduation (ownership marker + opt-in apply).
lex00
added a commit
that referenced
this pull request
Jul 22, 2026
) Apply graduation, the dial-turn from observe to apply. `chant carve apply --from <tf-dir> --select <address> --env <env>` resolves the ownership marker that makes the carved resource chant-owned (reusing core ownershipEntries) and finalizes the ordered apply runbook. BYOL-honest: no cloud call. It computes the marker + plan; the apply is your lifecycle (native CLI / CI / ApplyOp), which stamps the marker the emitted source carries. --write saves the graduation doc. - terraform/graduate.ts: ownership marker + tags (chant:managed-by/stack/env, mirroring the AWS lexicon's tag channel) + reversible runbook. - carve apply command: dry-run plan by default; --write emits the doc. - docs: cli/carve-out.mdx documents the full emit → bridge → apply arc. - carve-arc.test.ts: end-to-end, one resource through all three steps. PR C of 3 — completes the boundary-bridging carve (#197). emit + bridge + apply now compose end to end (advisor #214 → emit #995 → bridge #996 → apply).
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The boundary-bridging centerpiece of the strangler-fig carve (#197), on top of
carve emit(#995).chant carve bridge --from <tf-dir> --select <address>generates the edits to the Terraform you leave behind so its plan stays valid once the resource is chant-owned.What it generates
datasource for the (now chant-managed) carved resource, plus rewiredtype.name.attr→data.type.name.attrreferences in the survivors. The survivor keeps reading the resource, via a data source instead of a managed one.terraform state rm(does not destroy), patch survivors, adopt into chant, with aterraform importrollback at every step before graduation.Safety
--apply-rewritesedits the survivor.tfin place — opt-in mutation only.data.), and leaves the carved resource's ownresource "type" "name"declaration (quoted labels) alone.Notes
.tfis left as a runbook step, not auto-edited: hcl2json gives a JSON tree without source spans, so precise block excision from HCL text isn't reliable. The data-source insertion + reference rewiring — the part that breaksplanif missed — is generated.Verification
Part of #197.